﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using StuRecruitSysDAL;
using System.Threading;
using StuRecruitSysBLL;
using StuRecruitSysModels;



namespace StuRecruitSys
{
    public partial class Registe : System.Web.UI.Page
    {
        StudentService stus = new StudentService();
        RegisteManager regma = new RegisteManager();
        Student stu = new Student();

        protected void Page_Load(object sender, EventArgs e)
        {

        }

        protected void regist_click(object sender, EventArgs e)
        {

            stu.Username= this.first_name.Value.Trim();
            stu.Spwd = this.password.Value.Trim();
            stu.Email = this.email.Value.Trim();

            if (stu.Username == "")
            {
                if (!Page.ClientScript.IsStartupScriptRegistered("test"))
                {
                    Page.ClientScript.RegisterStartupScript(this.GetType(), "test", "<script language=javascript>alert('用户名不能为空!');</script>");
                    this.first_name.Focus();
                }

                return;
            }
            if (stu.Spwd == "")
            {
                if (!Page.ClientScript.IsStartupScriptRegistered("test"))
                {
                    Page.ClientScript.RegisterStartupScript(this.GetType(), "test", "<script language=javascript>alert('密码不能为空!');</script>");
                    this.password.Focus();
                }
                return;
            }
            if (stu.Email == "")
            {
                if (!Page.ClientScript.IsStartupScriptRegistered("test"))
                {
                    Page.ClientScript.RegisterStartupScript(this.GetType(), "test", "<script language=javascript>alert('邮箱不能为空!');</script>");
                    this.email.Focus();
                }
                return;
            }
            else
            {
                if (regma.Registe(stu))
                {
                    Page.ClientScript.RegisterStartupScript(this.GetType(), "test", "<script language=javascript>alert('注册成功！');</script>");

                }
            }
        }
    }
}